<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/3/1
 * Time: 18:07
 */
function https_curl($url,$data = null){
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL,$url);
    //针对ssl https协议
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,false);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    //检测get post方式提交数据
    if(!empty($data)){
        //设置post方式提交
        curl_setopt($curl, CURLOPT_POST, 1);
        //设置post数据
        curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
    }
    //执行命令
    $result = curl_exec($curl);
    //关闭URL请求
    curl_close($curl);
    //返回获得数据
    return $result;
}